package com.unhz.taigu.controller;

import com.unhz.generator.pojo.AreaDict;
import com.unhz.taigu.service.AreaDictService;
import com.unhz.taigu.service.impl.AreaDictServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: 沈佳庆
 * @Description: 行政区域数据字典
 * @Date: Created in 下午 8:54 2018/1/24 0024
 * @Modified By:
 */
@Controller
@RequestMapping("/areaDict")
public class AreaDictController {

    @Autowired
    private AreaDictService areaDictService;


    /**
     * 查询某个城市下面的地区
     * @param areaCode
     * @return
     */
    @RequestMapping("/findCountry")
    @ResponseBody
    public List<AreaDict> findCountry(@RequestParam("areaCode")String areaCode){
        List<AreaDict> list = areaDictService.findCountry(areaCode);
        return list;
    }

    /**
     * 查询某个省份下面的城市
     */
    @RequestMapping("/findCity")
    @ResponseBody
    public List<AreaDict> findCity(@RequestParam("areaCode")String areaCode){
        List<AreaDict> list = areaDictService.findCity(areaCode);
        return list;
    }

    /**
     * 查询所有省份
     * @return
     */
    @RequestMapping("/findProvince")
    @ResponseBody
    public List<AreaDict> findProvince(){
        List<AreaDict> list = areaDictService.findArea();
        return list;
    }



}
